#!/usr/bin/python
# Converts Fastq file to Fasta and Qual files
# Usage: python convertFastq2FastaQual2.py file.fastq file.fasta file.qual

import sys
from Bio import SeqIO
from StringIO import StringIO

fastqfile = sys.argv[1]
fastaout = open(sys.argv[2], "w")
qualout = open(sys.argv[3], "w")

fastah = StringIO("")
qualh = StringIO("")

SeqIO.convert(fastqfile, "fastq", fastah, "fasta")
fastaout.write(fastah.getvalue())

SeqIO.convert(fastqfile, "fastq", qualh, "qual")
qualout.write(qualh.getvalue())
